#include <func.h>
typedef struct{
    pthread_mutex_t mutex;
    pthread_cond_t cond;
}thdata_t;
void *thfunc(void *p)
{
    printf("I am subthread!\n");
    thdata_t* pt=(thdata_t*)p;
    pthread_mutex_lock(&pt->mutex);
    pthread_cond_wait(&pt->cond,&pt->mutex);
    pthread_mutex_unlock(&pt->mutex);
    printf("Wake succeed!\n");
}
int main(int argc,char *argv[])
{
    thdata_t t;
    int ret;
    pthread_t thid;
    printf("I am main thread!\n");
    pthread_mutex_init(&t.mutex,NULL);
    pthread_cond_init(&t.cond,NULL);
    pthread_create(&thid,NULL,thfunc,&t);
    sleep(1);
    pthread_cond_signal(&t.cond);
    pthread_join(thid,NULL);
    return 0;
}

